<template>
  <section>
    <el-dialog
      :visible.sync="visible">
      <el-tabs v-model="activeName" @tab-click="handleClick">
        <el-tab-pane label="支付宝" name="ZFB">
          <el-image
            style="width: 300px; height: 300px"
            :src="url"/>
          <el-form>
            <el-button type="primary" @click="comfirm">确 定</el-button>
          </el-form>
        </el-tab-pane>
        <el-tab-pane label="微信" name="WX">
          <el-image
            style="width: 300px; height: 300px"
            :src="url2"/>
          <el-form>
            <el-button type="primary" @click="comfirm">确 定</el-button>
          </el-form>
        </el-tab-pane>
      </el-tabs>
    </el-dialog>
  </section>
</template>

<script>
export default {
  name: "Pay",
  data() {
    return {
      visible: false,
      activeName: '',
      url: '../../../../../../static/img/pay/zfb.jpg',
      url2: '../../../../../../static/img/pay/weixin.jpg',
      row:{}
    }
  },
  methods: {
    handleClick(tab) {

    },
    show(row) {
      this.visible = true
      this.activeName = "ZFB"
      this.row = row
    },
    comfirm() {
      let _this = this
      this.$confirm("确认用户已支付", "提示", {
        confirmButtonText: '确认支付',
        cancelButtonText: '未支付',
        type: "warning"
      }).then(() => {
        var data = Object.assign({},_this.row)
        this.$set(data,'type',this.activeName)

        this.$axios.post("/orders/settle/confirmPay", data).then(resp => {
          if (resp.data.code === 200) {
            this.$message({
              message: resp.data.result,
              type: "success"
            })
            _this.visible = false
            _this.$emit('reload')
          }
        })
      })
    }
  }
}
</script>
<style scoped>

</style>
